from unittest import TestSuite
from Testing.ZopeTestCase.zopedoctest import ZopeDocFileSuite
from zope.testing.doctest import DocTestSuite, ELLIPSIS
from Products.MaildropHost.MaildropHost import MAIL_TEMPLATE

optionflags = (ELLIPSIS)


def dump(email):
    return MAIL_TEMPLATE % (email.m_to, email.m_from, email.body)


def setUp(test):
    test.globs['dump'] = dump


def test_suite():
    return TestSuite((
        ZopeDocFileSuite(
            'api-patch.txt',
            setUp=setUp,
            optionflags=optionflags,
            ),
        ZopeDocFileSuite('monster.txt'),
        ZopeDocFileSuite('example.txt'),
        DocTestSuite('ely.maildrophostmonster.rendering'),
    ))

